package com.wh.usercenter3.response;

import com.wh.usercenter3.constant.Code;
import com.wh.usercenter3.constant.CodeConstant;
import lombok.Data;

/**
 * 统一响应封装类
 */
@Data
public class Result<T> {

    private final int code;
    private final String message;
    private final T data;

    public Result(Code code, String message, T data) {
        this.code = code.getCode();
        this.message = message;
        this.data = data;
    }

    public Result(CodeConstant codeConstant, T data) {
        this.code = codeConstant.getCode().getCode();
        this.message = codeConstant.getMessage();
        this.data = data;
    }

}
